package com.vitas.coin.manager;

import android.content.Context;
import android.media.RingtoneManager;
import android.net.Uri;
import com.snap.util.log.SLog;

public class RingtoneHelper {

    public static void setRingtone(Context context, Uri newUri) {
        try {
            RingtoneManager.setActualDefaultRingtoneUri(context, RingtoneManager.TYPE_RINGTONE, newUri);
            RingtoneManager.setActualDefaultRingtoneUri(context, RingtoneManager.TYPE_ALARM, newUri);
        } catch (Throwable t) {
            SLog.INSTANCE.e("error"+t.getMessage());
            // 处理异常情况，例如用户没有设置铃声的权限
        }
    }
}